package com.dragon.sso.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerSecurityConfiguration;

/**
 * Create date 2020/8/16.
 *
 * @author evan
 */
@Configuration
@Order(2)
public class JwkSetEndpointConfiguration extends AuthorizationServerSecurityConfiguration {
  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http.exceptionHandling()
        .and()
        .requestMatchers()
        .mvcMatchers("/.well-known/jwks.json")
        .and()
        .authorizeRequests()
        .mvcMatchers("/.well-known/jwks.json")
        .permitAll();
  }
}
